﻿using System;
using System.Linq;
using WebExam.DataEntities;

namespace WebExam.DataProvider
{
    public interface IZYRepository
    {
        /// <summary>
        /// 获取专业信息
        /// </summary>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<ZY> GetAll(int start, int takeSize);

        /// <summary>
        /// 获取指定院系的专业信息
        /// </summary>
        /// <param name="yxId">院系Id</param>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<ZY> GetAll(int yxId, int start, int takeSize);

        /// <summary>
        /// 获取专业信息
        /// </summary>
        /// <param name="zyId">专业Id</param>
        ZY Get(int zyId);

        /// <summary>
        /// 添加专业信息
        /// </summary>
        /// <param name="zy">专业对象</param>
        ZY Add(ZY zy);

        /// <summary>
        /// 更新专业信息
        /// </summary>
        /// <param name="zyId">专业Id</param>
        /// <param name="update">包含更新操作的方法</param>
        ZY Update(int zyId, Action<ZY> update);

        /// <summary>
        /// 删除专业信息
        /// </summary>
        /// <param name="zyId">专业Id</param>
        bool Delete(int zyId);

        /// <summary>
        /// 专业是否存在
        /// </summary>
        /// <param name="zyName">专业名称</param>
        bool IsExists(string zyName);

        /// <summary>
        /// 获取专业个数 
        /// </summary>
        int Count();

        /// <summary>
        /// 获取指定院系下的专业个数
        /// </summary>
        /// <param name="yxId">院系Id</param>
        int Count(int yxId);
    }
}